#ifndef __CORDET_H__
#define __CORDET_H__


class Harris{

public:
	int detectCorners(

	    float *image_p,    /* pointer to image of brightness*/
	    int    xImageSize_p, /*width of image */
	    int    yImageSize_p, /*height of image*/
      float  k,           /* experimental constant, in range 0.04-0.13*/
      int gaussMaskSize, /*the size of Gaussian */
      float sigma,       /* sigma for gaussian */
      float treshold,   /* all values bigger than this value will be corners in corner map */
	    int    *cornerList, /* output of the method, pairs of X and Y coordinates*/
	    int    cornerListLen ); /* length of the list*/

private:
	float *image;           /* pointer to the input image */
	int    xImageSize;      /* width of the input image */
	int    yImageSize;      /* height of the input image */
	int    numImagePixs;    /* number of pixels in the image */
  float   k;              /* harris value, optional 0.04 */
  float   sigma;          /* used in gauss filtering */
  int   gaussMaskSize;    /* gauss mask size */
	int   *corners;         /* pointer to array containing the corners */
	float treshold;         /*the values of CRF bigger then this value are corners*/
	float* corrs;				    /* result of CRF */

  float *Ix;
  float *Iy;
  float *Ixy;

	/* Functions */
	void createGaussMap(void);
	void computeGrads(void);
	void HarrisOp(int radius, float sigma, float k);
  void showImage(float *image, int x, int y, const char* filename);
  short isCorrMax(int imgPosQ);
	int gaussFilter(float *img, int x_res, int y_res, int radius,float sigma);
	int findCorners(int *cornerList, const int cornerListLen);
  int gaussFilter2(float *img, int width, int height, int radius,float sigma);
};


#endif
